package com.example.springcloudapi.service;

import com.example.springcloudapi.pojo.Dept;
import feign.hystrix.FallbackFactory;

import java.util.List;

public class DeptClientServiceFallBackFactory implements FallbackFactory {
    @Override
    public Object create(Throwable throwable) {
        return new DeptClientService() {
            @Override
            public Dept queryById(Long no) {
                return new Dept().
                        setDeptno(no).
                        setDeptname("此id没有此信息，此为客户端提供的降级信息，这个服务或已被关闭").
                        setDb_source("no database in mysql");
            }

            @Override
            public List<Dept> queryAll() {
                return null;
            }
        };
    }
}
